﻿@using Kudu.Core.SourceControl
@using Kudu.Core.Deployment

@model IList<LogEntry>
@{
    ViewBag.Title = "Deployments";

    bool verbose = ViewBag.verbose != null && ViewBag.verbose;
}

@if (Model.Count == 0) 
{
    <p class="alert alert-info">Nothing to see here.</p>
    return;
}

<ul id="log">
@{ var index = 0; }
@foreach (var log in Model)
{
    string icon = "glyphicon glyphicon-ok";

    switch (log.Type)
    {
        case LogEntryType.Warning:
            icon = "glyphicon glyphicon-info-sign";
            break;
        case LogEntryType.Error:
            icon = "glyphicon glyphicon-remove";
            break;
    }
    
    <li>
    @if (verbose)
    {
<pre>@log.Message</pre>
    }
    else
    {
        <i class="@icon"></i>
        @log.LogTime <span>@log.Message </span>
    }
    @if (log.DetailsUrl != null)
    { 
        <a href="@Url.RouteUrl("DeploymentLogVerbose", new { slug = ViewBag.slug, id = ViewBag.id, logId = log.Id })">Details</a>
    }
    </li>
    index++;
}
</ul>